package script;

import api.UserApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.AssertUtil;
import utils.ResponseData;
import utils.TestDataUtil;

import java.io.IOException;

public class TestModifyUserStatus {
    private UserApi userApi = new UserApi();
    private static final Logger logger = LoggerFactory.getLogger(TestModifyUserStatus.class);
    @DataProvider
    public Object[][] dataBuild() throws IOException {
        Object[][] buildData = TestDataUtil.buildData("lockUserData.json", "id,lockStatus,status,description");
        logger.info("buildData={}",buildData);
        return buildData;
    }
    @Test(dataProvider = "dataBuild")
    public void testLock(String id,String lockStatus,int status,String desc) throws Exception {
        ResponseData responseData = userApi.modifyUserStatus(id, lockStatus);
        AssertUtil.commonAssert(responseData,responseData.getStatusCode(),desc,status);
    }

}
